package jin.si.com.xc;

/**
 * @description:
 * @ClassName TestMyRunnable
 * @Author MT
 * @Date 2021/7/2 14:55
 **/
public class TestMyRunnable {

    public static void main(String[] args) throws InterruptedException {

        MyRunnable my=new MyRunnable();

        Thread t1=new Thread(my,"窗口1");
        Thread t2=new Thread(my,"窗口2");
        Thread t3=new Thread(my,"窗口3");

        // 获取优先级 t.getPriority()
        //System.out.println(t1.getPriority());

        //线程的优先级 1-10，默认是5，线程优先级尽量让线程优先执行，但不能保证线程优先执行
        //t.setPriority() 设置线程优先级
        t1.setPriority(10);
        t2.setPriority(1);

        //t1.join();


        /*//设置守护线程
        t1.setDaemon(true);
        t2.setDaemon(true);
        t3.setDaemon(true);*/

        t1.start();
        t2.start();
        t3.start();


        /*Thread.sleep(10000);
        //杀死线程，这是java的过期方法，只要有横线都是过期，开发不使用
        t1.stop();
        t2.stop();
        t3.stop();*/

        //中断线程
        t1.interrupt();
        t2.interrupt();
        t3.interrupt();



        /*for(int a=0;a<10;a++){
            System.out.println(Thread.currentThread().getName()+a);
        }*/


    }

}
